/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package models;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;

/**
 *
 * @author Achie
 */
@Entity
@Table(name = "assignment_handin")
public class AssignmentHandin implements Serializable {
    @Id
    @GeneratedValue
    @Column(name = "id")
    private long id;
    @ManyToOne
    @JoinColumn(name = "assignment_id")
    private Files assignment;
    @ManyToOne
    @JoinColumn(name = "student_id")
    private Student student;
    @Column(name="date_added") 
    @Temporal(javax.persistence.TemporalType.DATE)
    private Date date;
    @Column(name="description")
    private String description;
    @Column(name="url")
    private String url;
    @Column(name="grade")
    private String grade = "0";
    @Column(name="feedback")
    private String feedback;

    public AssignmentHandin() {
        
    }
    
    public AssignmentHandin(long id, Files assignment, Student student, String description, String url) {
        this.setId(id);
        //this.setAssignment_id(assignment);
        //this.setStudent(student);
        this.setAssignment(assignment);
        this.setStudent(student);
        this.setDescription(description);
        this.setUrl(url);
        this.setDate();
    }
    
    /**
     * @return the id
     */
    public long getId() {
        return id;
    }

    /**
     * @param id the id to set
     */
    public void setId(long id) {
        this.id = id;
    }

    /**
     * @return the assignment_id
     */


    /**
     * @return the student_id
     */


    /**
     * @return the date
     */
    public Date getDate() {
        return date;
    }

    /**
     * @param date the date to set
     */
    public void setDate() {
        Date date = new Date();
        this.date = date;
    }

    /**
     * @return the description
     */
    public String getDescription() {
        return description;
    }

    /**
     * @param description the description to set
     */
    public void setDescription(String description) {
        this.description = description;
    }

    /**
     * @return the url
     */
    public String getUrl() {
        return url;
    }

    /**
     * @param url the url to set
     */
    public void setUrl(String url) {
        this.url = url;
    }

    /**
     * @return the assignment
     */
    public Files getAssignment() {
        return assignment;
    }

    /**
     * @param assignment the assignment to set
     */
    public void setAssignment(Files assignment) {
        this.assignment = assignment;
    }

    /**
     * @return the student
     */
    public Student getStudent() {
        return student;
    }

    /**
     * @param student the student to set
     */
    public void setStudent(Student student) {
        this.student = student;
    }

    /**
     * @return the grade
     */
    public String getGrade() {
        return grade;
    }

    /**
     * @param grade the grade to set
     */
    public void setGrade(String grade) {
        this.grade = grade;
    }

    /**
     * @return the feedback
     */
    public String getFeedback() {
        return feedback;
    }

    /**
     * @param feedback the feedback to set
     */
    public void setFeedback(String feedback) {
        this.feedback = feedback;
    }
    
    
    
}
